﻿
using System.ServiceModel;
using BankerenClient.BankerenService;
using BankerenClient.Events;
using Caliburn.Micro;

namespace BankerenClient
{
    [ServiceBehavior(UseSynchronizationContext = false)]
    public class ShellViewModel : Conductor<IMainScreen>, IHandle<BankerenEvent>, IBankerenCallback
    {
        #region Fields

        private PlayGameViewModel playGame;

        #endregion

        public ShellViewModel()
        {
            this.DisplayName = "Bankeren";
            this.playGame = new PlayGameViewModel();
            EventAggregationProvider.EventAggregator.Subscribe(this);
            ActivateItem(new MainMenuViewModel());
        }

        public void Handle(BankerenEvent e)
        {
            switch (e.Type)
            {
                case BankerenEventType.GotoMainMenu:
                    ActivateItem(new MainMenuViewModel());
                    break;
                case BankerenEventType.GotoJoinGame:
                    ActivateItem(new JoinGameViewModel());
                    break;
                case BankerenEventType.GotoHostGame:
                    ActivateItem(new HostGameViewModel());
                    break;
                case BankerenEventType.GotoPlayGame:
                    ActivateItem(new PlayGameViewModel());
                    break;
                case BankerenEventType.JoinGame:
                    break;
                case BankerenEventType.HostGame:
                    break;
                case BankerenEventType.MakeBid:
                    break;
                case BankerenEventType.SendChat:
                    break;
                case BankerenEventType.PlaceCard:
                    break;
                case BankerenEventType.ChangeInfo:
                    break;
                case BankerenEventType.Quit:
                    TryClose();
                    break;
                default:
                    break;
            }
        }

        #region Callback Methods

        public void Welcome(int seat, System.Collections.Generic.Dictionary<int, Bankeren.Engine.PlayerInfo> players)
        {
            throw new System.NotImplementedException();
        }

        public void PlayerJoined(int seat, Bankeren.Engine.PlayerInfo info)
        {
            throw new System.NotImplementedException();
        }

        public void PlayerInfoChanged(int seat, Bankeren.Engine.PlayerInfo info)
        {
            throw new System.NotImplementedException();
        }

        public void PlayerLeft(int seat)
        {
            throw new System.NotImplementedException();
        }

        public void GameStarted()
        {
            throw new System.NotImplementedException();
        }

        public void DealCards(Bankeren.Engine.Cards.Card[] cards)
        {
            throw new System.NotImplementedException();
        }

        public void RoundStarted(int roundNumber, int numCards, int dealerSeat, Bankeren.Engine.Cards.Card trump)
        {
            throw new System.NotImplementedException();
        }

        public void Bids(System.Collections.Generic.Dictionary<int, int> bids1)
        {
            throw new System.NotImplementedException();
        }

        public void TrickStarted(int trickNumber)
        {
            throw new System.NotImplementedException();
        }

        public void Turn(int seat, Bankeren.Engine.Cards.Suit followSuit)
        {
            throw new System.NotImplementedException();
        }

        public void CardPlayed(int seat, Bankeren.Engine.Cards.Card card)
        {
            throw new System.NotImplementedException();
        }

        public void TrickEnded(int winner)
        {
            throw new System.NotImplementedException();
        }

        public void RoundEnded(System.Collections.Generic.Dictionary<int, int> points)
        {
            throw new System.NotImplementedException();
        }

        public void GameEnded(int winner)
        {
            throw new System.NotImplementedException();
        }

        public void Chat(int seat, string message)
        {
            throw new System.NotImplementedException();
        }

        public void ServerStopped(string message)
        {
            throw new System.NotImplementedException();
        }

        #endregion

    }
}
